<template>
  <div class="eventLevel">
    <CommonBtn label-name="人员信息管理" v-if="!button || (button.event!='add()' && button.event!='edit()' && button.event!='detail()') " :buttons="buttons" @onButtonClick="onButtonClick">
      <!-- <span slot="conditions" v-for="(item,index) of conditions" :key="index" v-if="item.checked">{{item.label+":"+item.value}}</span> -->
    </CommonBtn>
    <CommonList ref="list" v-if="!button || (button.event!='add()' && button.event!='edit()' && button.event!='detail()')" :buttons="buttons"
                :columns="columns" :listUrl="listUrl" @tableSelect="tableSelect" :conditions="conditions" @dbClick="openItem" :status="0"></CommonList>
    <CommonEdit v-if="button && (button.event=='add()' || button.event=='edit()' || button.event=='detail()')"
                :outBtn="button" :props="tagType"
                :original-data="row" :add-url="$api.API_GET_MDM_ORG_REP" :edit-url="$api.API_GET_ORG_UPDATEORGJNJ"
                :edit-urls="$api.API_GET_ORG_UPDATEORGOTHER"
                @editBack="editBack"></CommonEdit>

    <!-- <search-pop-up :out-btn="button"
                   :props="columns" @close="close"
                   :out-conditions="conditions"
                   @conditionChange="conditionChange"></search-pop-up> -->
    <CommonExport :out-btn="button" :props="columns" :status="0"
                  @close="close" :export-url="$api.API_MDM_ORG_EXPORTMDMROGREP" :conditions="conditions"></CommonExport>

    <EnsurePopUp :out-btn="button" @close="close" @refresh="conditionChange" :original-data="row"
                 :delete-url="$api.API_SET_DEP"></EnsurePopUp>
        <!-- <CommonSearch
                  :label="item.label"
                  :conditions="item.conditions"
                  v-for="(item, index) of []"
                  :key="index"
                  :listUrl="item.listUrl"
                  :columns="item.columns"
                  :items="item.items"
                  :page="item.page"
                  :originalData="item.searchData"
                  @search="search"
                  @submit="item.selectItem"
                  @searchBack="searchBack"/> -->
    <CommonInport :out-btn="button" @close="close" :inportUrl="inportUrlAPI" :template-url="templateUrl"></CommonInport>
    <CommonSearchPend :label="item.label"
                  :conditions="item.conditions"
                  v-for="(item, index) of searchs"
                  :key="index"
                  :listUrl="item.listUrl"
                  :columns="item.columns"
                  :items="item.items"
                  :page="item.page"
                  :pageType="pageType"
                  :originalData="item.searchData"
                  @submit="item.selectItem"
                  @searchBack="searchBack"/>
  </div>
</template>

<script>
    import CommonList from "../../common/CommonList"
    import CommonBtn from "../../common/CommonBtn";
    import CommonEdit from "../../common/CommonEdit";
    import SearchPopUp from "../../common/SearchPopUp";
    import CommonExport from "../../common/CommonExport";
    import EnsurePopUp from "../../common/EnsurePopUp";
    import CommonInport from "../../common/CommonInport";
    import CommonSearchPend from '../../common/CommonSearchPend'
import { Select } from 'element-ui';
    export default {
        name:'ServiceAttributeSetting',
        data(){
            return{
                buttons:[
                    this.$config.BTNS.ADD,
                    this.$config.BTNS.EDIT,
                    this.$config.BTNS.DETAIL,
                    this.$config.BTNS.EXPORT,
                    this.$config.BTNS.SEARCH,
                ],
                columns:[
                   {
                        prop:'accountNumber',
                        label:'账号',
                    },
                   {
                        prop:'wwid',
                        label:'WWID',
                        search:true,
                        type:'text'
                    },
                    {
                        prop:'repNameCn',
                        label:'人员姓名',
                        search:true,
                        type:'text'
                    },
                    {
                        prop:'repNameEn',
                        label:'英文姓名',
                    },
                    {
                        prop:'email',
                        label:'邮箱',
                        search:true,
                        type:'text'
                    },
                    {
                        prop:'gender',
                        label:'性别',
                    },
                    {
                        prop:'phone',
                        label:'手机号'
                    },
                    {
                        prop:'repType',
                        label:'角色',
                    },
                    {
                        prop:'inDate',
                        label:'入职时间'
                    },
                    {
                        prop:'outDate',
                        label:'离职时间'
                    },
                    {
                        prop:'workingCity',
                        label:'工作城市'
                    },
                    {
                        prop:'costCenterName',
                        label:'成本中心'
                    },
                    {
                        prop:'customerName',
                        label:'所属客户'
                    },
                    {
                        prop:'salesmanName',
                        label:'强生销售人员'
                    },
                    {
                        prop:'customerType',
                        label:'所属客户类型'
                    },
                    {
                        prop:'level',
                        label:'职位'
                    },
                    {
                        prop:'terminated',
                        label:'是否在职'
                    },
                    {
                        prop:'parentName',
                        label:'直属领导',
                        search:true,
                        type:'text'
                    },
                    {
                        prop:'buName',
                        label:'部门',
                        search:true,
                        type:'text'
                    },
                    {
                        prop:'channelName',
                        label:'渠道',
                        search:true,
                        type:'text'
                    },
                    {
                        prop:'areaName',
                        label:'地区',
                        search:true,
                        type:'text'
                    },
                    {
                        prop:'attrName',
                        label:'业务属性',
                        search:true,
                        type:'text'
                    },
                    {
                        prop:'regName',
                        label:'大区',
                        search:true,
                        type:'text'
                    },
                ],
                listUrl:this.$api.API_GET_MDM_ORG_LIST,
                depList:[],
                attrList:[],
                zoneList:[],
                regList:[],
                channelList:[],
                button:null,
                searchs:[],
                conditions:[],
                add:{
                    label:'部门',
                    addItems:[
                        {name:'人员姓名',prop:'repName',type:'text',required:true},
                        {name:'邮箱',prop:'email',type:'text'},
                        {name:'性别',type:'select',prop:'gender',options:[
                         { value:0,label:'女'},
                         { value:1,label:'男'}
                         ]},
                        {name:'手机号',prop:'phone',type:'text'},
                        {name:'强生销售人员',prop:'salesman',type:'search',
                          search:true,label:'强生销售人员',required:true,
                          columns:[
                              {
                                  prop:'repNameCn',
                                  label:'姓名',
                                  search:true,
                                  type:'text'
                              },
                              {
                                  prop:'wwid',
                                  label:'WWID',
                                  search:true,
                                  type:'text'
                              }
                          ],
                          searchUrl:this.$api.API_Leader_LIST,
                          searchLabel:'负责人列表',
                          proxy:'repNameCn',
                          searchProxy:'repNameCn',
                          searchValue:'pkid',
                        },
                        {name:'所属客户',prop:'customerName',type:'search',
                          search:true,label:'所属客户',required:true,
                          columns:[
                              {
                                  prop:'customerName',
                                  label:'类别',
                                  search:true,
                                  type:'text'
                              },
                          ],
                          searchUrl:this.$api.API_GET_ORG_CUSTOMER,
                          searchLabel:'负责人列表',
                          proxy:'customerName',
                          searchProxy:'customerName',
                          searchValue:'customerCode',
                        },
                        {name:'业务属性',prop:'fkPosition',type:'select',options:[]},
                        {name:'账号状态',prop:'accountState',type:'select',required:true,options:[
                         { value:0,label:'有效'},
                         { value:1,label:'无效'}
                         ]},
                        {name:'备注',prop:'memo',type:'text'},
                    ],
                },
                edit:{
                  label:'部门',
                  addItems:[
                      {name:'WWID',prop:'wwid',type:'text',disable:true,placeholder:'系统自动生成'},
                      {name:'人员姓名',prop:'repNameCn',type:'text',disable:true},
                      {name:'英文姓名',prop:'repNameEn',type:'text',disable:true},
                      {name:'邮箱',prop:'email',type:'text',disable:true},
                      {name:'性别',type:'select',prop:'gender',disable:true,options:[
                        { value:0,label:'女'},
                        { value:1,label:'男'}
                        ]},
                      {name:'手机号',prop:'phone',type:'text',disable:true},
                      {name:'角色',prop:'repType',type:'select',disable:true,
                      options:[
                        { value:1,label:'jnj员工'},
                        { value:2,label:'三方人员'},
                        { value:3,label:'外部人员'},
                        ]
                      },
                      {name:'入职时间',prop:'inDate',type:'date',disable:true},
                      {name:'离职时间',prop:'outDate',type:'date',disable:true},
                      {name:'工作城市',prop:'workingCity',type:'text',disable:true},
                      {name:'成本中心',prop:'costCenterName',type:'text',disable:true},
                      // {name:'所属客户',prop:'customerName',type:'text',disable:true},
                      {name:'强生销售人员',prop:'salesman',type:'search',options:[],disable:true,
                        columns:[
                            {
                                prop:'salesmanName',
                                label:'姓名',
                                search:true,
                                type:'text'
                            },
                            {
                                prop:'wwid',
                                label:'WWID',
                                search:true,
                                type:'text'
                            }
                        ],
                        searchUrl:this.$api.API_GET_ORG_SALESMAN,
                        searchLabel:'负责人列表',
                        proxy:'salesmanName',
                        searchProxy:'salesmanName',
                        searchValue:'pkid',
                      },
                      {name:'职位',prop:'level',type:'text',disable:true},
                      {name:'是否在职',prop:'terminated',type:'select',disable:true,options:[
                        { value:0,label:'离职'},
                        { value:1,label:'在职'}
                        ]},
                      {name:'主管',prop:'fkParent',search:true,label:'主管',
                        type:'search',
                        columns:[
                            {
                                prop:'repNameCn',
                                label:'姓名',
                                search:true,
                                type:'text'
                            },
                            {
                                prop:'wwid',
                                label:'WWID',
                                search:true,
                                type:'text'
                            }
                        ],
                        searchUrl:this.$api.API_Leader_LIST,
                        searchLabel:'负责人列表',
                        proxy:'repNameCn',
                        searchProxy:'repNameCn',
                        searchValue:'pkid'},
                      {name:'渠道',prop:'fkChannel',type:'search',options:[],required:true,
                          columns:[
                              {
                                  prop:'channelName',
                                  label:'类别',
                                  search:true,
                                  type:'text'
                              },
                          ],
                          searchUrl:this.$api.API_SELECT_CHANNEL_LIST,
                          searchLabel:'负责人列表',
                          proxy:'channelName',
                          searchProxy:'channelName',
                          searchValue:'pkid'},
                      {name:'地区',prop:'fkZone',type:'search',options:[],required:true,
                          columns:[
                              {
                                  prop:'areaName',
                                  label:'类别',
                                  search:true,
                                  type:'text'
                              },
                          ],
                          searchUrl:this.$api.API_SELECT_AREA_LIST,
                          searchLabel:'负责人列表',
                          proxy:'areaName',
                          searchProxy:'areaName',
                          searchValue:'pkid'
                      },
                      {name:'大区',prop:'fkRegion',type:'search',options:[],required:true,
                        columns:[
                              {
                                  prop:'regName',
                                  label:'类别',
                                  search:true,
                                  type:'text'
                              },
                          ],
                          searchUrl:this.$api.API_SELECT_REG_LIST,
                          searchLabel:'负责人列表',
                          proxy:'regName',
                          searchProxy:'regName',
                          searchValue:'pkid'
                      },
                      {name:'业务属性',prop:'fkPosition',type:'search',options:[],
                        columns:[
                              {
                                  prop:'attrName',
                                  label:'类别',
                                  search:true,
                                  type:'text'
                              },
                          ],
                          searchUrl:this.$api.API_SELECT_ATTR_LIST,
                          searchLabel:'负责人列表',
                          proxy:'attrName',
                          searchProxy:'attrName',
                          searchValue:'pkid'
                      },
                      {name:'所属客户',prop:'customerName',type:'search',
                          search:true,label:'所属客户',required:true,
                          columns:[
                              {
                                  prop:'customerName',
                                  label:'类别',
                                  search:true,
                                  type:'text'
                              },
                          ],
                          searchUrl:this.$api.API_GET_ORG_CUSTOMER,
                          searchLabel:'负责人列表',
                          proxy:'customerName',
                          searchProxy:'customerName',
                          searchValue:'customerCode',
                      },
                      {name:'长假标识',prop:'isHoliday',type:'select',required:true,options:[
                         { value:1,label:'YES'},
                         { value:0,label:'NO'}
                      ]},
                      {name:'长假开始时间',prop:'holidayStartTime',type:'date',isDisable: 1},
                      {name:'长假结束时间',prop:'holidayEndTime',type:'date',isDisable: 1},
                      {name:'是否考核奖金',prop:'isEvaluationBonus',type:'select',required:true,options:[
                        { value:1,label:'YES'},
                        { value:0,label:'NO'}
                      ]},
                      {name:'考核奖金开始时间',prop:'ebStartTime',type:'date',isDisable: 2},
                      {name:'考核奖金结束时间',prop:'ebEndTime',type:'date',isDisable: 2},
                      {name:'账号状态',prop:'accountState',type:'select',required:true,options:[
                         { value:1,label:'启用'},
                         { value:0,label:'禁用'}
                         ]},
                      {name:'备注',prop:'memo',type:'text'},
                  ],
                },
                edit1:{
                    label:'部门',
                    addItems:[
                        {name:'账号',prop:'accountNumber',type:'text',disable:true,},
                        {name:'WWID',prop:'wwid',type:'text',disable:true,placeholder:'系统自动生成'},
                        {name:'人员姓名',prop:'repNameCn',type:'text',disable:true},
                        {name:'英文姓名',prop:'repNameEn',type:'text',disable:true},
                        {name:'邮箱',prop:'email',type:'text'},
                        {name:'性别',type:'select',prop:'gender',disable:true,options:[
                         { value:0,label:'女'},
                         { value:1,label:'男'}
                         ]},
                        {name:'手机号',prop:'phone',type:'text'},
                        {name:'角色',prop:'repType',type:'select',disable:true,
                          options:[
                          { value:1,label:'jnj员工'},
                          { value:2,label:'三方人员'},
                          { value:3,label:'外部人员'},
                          ]
                        },
                        {name:'强生销售人员',prop:'salesman',type:'search',options:[],
                          columns:[
                              {
                                  prop:'salesmanName',
                                  label:'姓名',
                                  search:true,
                                  type:'text'
                              },
                              {
                                  prop:'wwid',
                                  label:'WWID',
                                  search:true,
                                  type:'text'
                              }
                          ],
                          searchUrl:this.$api.API_GET_ORG_SALESMAN,
                          searchLabel:'负责人列表',
                          proxy:'salesmanName',
                          searchProxy:'salesmanName',
                          searchValue:'salesmanId',
                        },
                        {name:'所属客户',prop:'customerName',type:'search',
                            search:true,label:'所属客户',
                            columns:[
                                {
                                    prop:'customerName',
                                    label:'类别',
                                    search:true,
                                    type:'text'
                                },
                            ],
                            searchUrl:this.$api.API_GET_ORG_CUSTOMER,
                            searchLabel:'负责人列表',
                            proxy:'customerName',
                            searchProxy:'customerName',
                            searchValue:'customerCode',
                        },
                        {name:'是否在职',prop:'terminated',type:'select',disable:true,options:[
                         { value:0,label:'离职'},
                         { value:1,label:'在职'}
                         ]},
                        {name:'业务属性',prop:'fkPosition',type:'search',options:[],
                          columns:[
                                {
                                    prop:'attrName',
                                    label:'类别',
                                    search:true,
                                    type:'text'
                                },
                            ],
                            searchUrl:this.$api.API_SELECT_ATTR_LIST,
                            searchLabel:'负责人列表',
                            proxy:'attrName',
                            searchProxy:'attrName',
                            searchValue:'pkid'
                        },
                        {name:'账号状态',prop:'accountState',type:'select',required:true,options:[
                         { value:0,label:'启用'},
                         { value:1,label:'禁用'}
                        ]},
                        {name:'备注',prop:'memo',type:'text'},
                    ],
                },
                detail:{
                    label:'部门',
                    addItems:[
                        {name:'WWID',prop:'wwid',type:'text',disable:true,placeholder:'系统自动生成'},
                        {name:'人员姓名',prop:'repNameCn',type:'text'},
                        {name:'英文姓名',prop:'repNameEn',type:'text'},
                        {name:'邮箱',prop:'email',type:'text'},
                        {name:'性别',type:'select',prop:'gender',disable:true,options:[
                         { value:0,label:'女'},
                         { value:1,label:'男'}
                         ]},
                        {name:'手机号',prop:'phone',type:'text',disable:true},
                        {name:'角色',prop:'repType',type:'select',disable:true,
                        options:[
                         { value:1,label:'jnj员工'},
                         { value:2,label:'三方人员'},
                         { value:3,label:'外部人员'},
                         ]
                        },
                        {name:'入职时间',prop:'inDate',type:'date',disable:true},
                        {name:'离职时间',prop:'outDate',type:'date',disable:true},
                        {name:'工作城市',prop:'workingCity',type:'text',disable:true},
                        {name:'成本中心',prop:'costCenterName',type:'text',disable:true},
                        {name:'所属客户',prop:'customerName',type:'text',disable:true},
                        {name:'强生销售人员',prop:'salesman',type:'search',
                          search:true,label:'直属领导',disable:true,
                          columns:[
                              {
                                  prop:'repNameCn',
                                  label:'姓名',
                                  search:true,
                                  type:'text'
                              },
                              {
                                  prop:'wwid',
                                  label:'WWID',
                                  search:true,
                                  type:'text'
                              }
                          ],
                          searchUrl:this.$api.API_Leader_LIST,
                          searchLabel:'负责人列表',
                          proxy:'repNameCn',
                          searchProxy:'repNameCn',
                          searchValue:'pkid',
                        },
                        {name:'所属客户类型',prop:'customerType',type:'select',disable:true,options:[
                         { value:2,label:'经销商'},
                         { value:1,label:'客户集团'}
                         ]},
                        {name:'职位',prop:'level',type:'text',disable:true},
                        {name:'是否在职',prop:'terminated',type:'select',disable:true,options:[
                         { value:0,label:'离职'},
                         { value:1,label:'在职'}
                         ]},
                        {name:'直属领导',prop:'fkParent',search:true,label:'直属领导',
                          disable:true,
                          type:'search',
                          columns:[
                              {
                                  prop:'repNameCn',
                                  label:'姓名',
                                  search:true,
                                  type:'text'
                              },
                              {
                                  prop:'wwid',
                                  label:'WWID',
                                  search:true,
                                  type:'text'
                              }
                          ],
                          searchUrl:this.$api.API_Leader_LIST,
                          searchLabel:'负责人列表',
                          proxy:'repNameCn',
                          searchProxy:'repNameCn1',
                          searchValue:'pkid'},
                        {name:'部门',prop:'fkBu',type:'select',options:[],disable:true},
                        {name:'渠道',prop:'fkChannel',type:'select',options:[],disable:true},
                        {name:'地区',prop:'fkRegion',type:'select',options:[],disable:true},
                        {name:'大区',prop:'fkZone',type:'select',options:[],disable:true},
                        {name:'业务属性',prop:'attrName',type:'select',options:[],disable:true},
                    ],
                },
                add11:{
                    label:'部门',
                    addItems:[
                        {name:'WWID',prop:'wwid',type:'text',required:true,disable:true,placeholder:'系统自动生成'},
                        {name:'人员姓名',prop:'repName',type:'text',required:true},
                        {name:'英文姓名',prop:'repNameEn',type:'text',required:true},
                        {name:'邮箱',prop:'email',type:'text'},
                        {name:'性别',type:'select',prop:'gender',options:[
                         { value:0,label:'女'},
                         { value:1,label:'男'}
                         ]},
                        {name:'手机号',prop:'phone',type:'text'},
                        {name:'角色',prop:'repType',type:'select',
                        options:[
                         { value:1,label:'jnj员工'},
                         { value:2,label:'三方人员'},
                         { value:3,label:'外部人员'},
                         ]
                        },
                        {name:'入职时间',prop:'inDate',type:'date',disable:true},
                        {name:'离职时间',prop:'outDate',type:'date'},
                        {name:'工作城市',prop:'workingCity',type:'text'},
                        {name:'成本中心',prop:'costCenterName',type:'text'},
                        // {name:'所属客户',prop:'customerName',type:'text'},
                        {name:'强生销售人员',prop:'salesman',type:'search',
                          search:true,label:'直属领导',required:true,
                          columns:[
                              {
                                  prop:'repNameCn',
                                  label:'姓名',
                                  search:true,
                                  type:'text'
                              },
                              {
                                  prop:'wwid',
                                  label:'WWID',
                                  search:true,
                                  type:'text'
                              }
                          ],
                          searchUrl:this.$api.API_Leader_LIST,
                          searchLabel:'负责人列表',
                          proxy:'repNameCn',
                          searchProxy:'repNameCn',
                          searchValue:'pkid',
                        },
                        {name:'所属客户类型',prop:'customerType',type:'text'},
                        {name:'职位',prop:'level',type:'text'},
                        {name:'是否在职',prop:'terminated',type:'select',options:[
                         { value:0,label:'离职'},
                         { value:1,label:'在职'}
                         ]},
                        {name:'直属领导',prop:'fkParent',search:true,label:'直属领导',
                          required:true,
                          type:'search',
                          columns:[
                              {
                                  prop:'repNameCn',
                                  label:'姓名',
                                  search:true,
                                  type:'text'
                              },
                              {
                                  prop:'wwid',
                                  label:'WWID',
                                  search:true,
                                  type:'text'
                              }
                          ],
                          searchUrl:this.$api.API_Leader_LIST,
                          searchLabel:'负责人列表',
                          proxy:'repNameCn',
                          searchProxy:'repNameCn1',
                          searchValue:'pkid'},
                        {name:'部门',prop:'fkBu',type:'select',options:[],required:true},
                        {name:'渠道',prop:'fkChannel',type:'select',options:[],required:true},
                        {name:'地区',prop:'fkRegion',type:'select',options:[],required:true},
                        {name:'大区',prop:'fkZone',type:'select',options:[],required:true},
                        {name:'业务属性',prop:'attrName',type:'select',options:[],required:true},
                    ],
                },
                row:{},
                tagType: {},
                templateUrl : "/static/template/门店导入模板.xls",
                searchData: {},
                searchItems: [
                     { "checked": false, "key": "wwid", "name": "WWID", "value": "", "type": "text" }, 
                    { "checked": false, "key": "repNameCn", "name": "人员姓名", "value": "", "type": "text" },
                    { "checked": false, "key": "email", "name": "邮箱", "value": "", "type": "text" }, 
                    // { "checked": false, "key": "parentName", "name": "直属领导", "value": "", "type": "text" },
                    { "checked": false, "key": "parentName", "name": "主管", "value": "", "type": "search" }, 
                    { "checked": false, "key": "channelName", "name": "渠道", "value": "", "type": "search" },
                    { "checked": false, "key": "regionName", "name": "地区", "value": "", "type": "search" }, 
                    { "checked": false, "key": "attrName", "name": "业务属性", "value": "", "type": "search" }, 
                    { "checked": false, "key": "zoneName", "name": "大区", "value": "", "type": "search" }
                ],
                // conditions:[{
                //   checked: true,
                //   prop: 'pageType',
                //   value: '1'
                // }],
                inportUrlAPI: '',
                pageType: 1,
            }
        },
        methods:{
            onButtonClick(item) {
              // console.log(item, this.row, 'item');
                if (item.event == 'edit()' || item.event == 'Delete()' || item.event == 'disable()' || item.event == 'enable()' || item.event == 'detail()') {
                    if (!this.row || JSON.stringify(this.row) == '{}') {
                        this.$message.error("请选择一行数据")
                        return
                    }
                }
                if (item.event == 'add()') {
                    this.tagType = this.add
                    this.row = {}
                } else if (item.event == 'edit()') {
                  if (this.row.repTypeCode == 1 || this.row.repTypeCode == 2) {
                    this.tagType = this.edit
                  } else if (this.row.repTypeCode == 3) {
                    this.tagType = this.edit1
                  }
                } else if (item.event == 'detail()') {
                  this.tagType = this.detail
                } else if (item.event == 'inport()') {
                  let self = this
                  if (item.name == "Workday人员导入") {
                    this.templateUrl = "/static/template/门店导入模板.xls"
                    this.inportUrlAPI = this.$api.API_MDM_ORG_IMPORTJNJORG
                  } else if (item.name == "外部人员导入") {
                    this.templateUrl = "/static/template/门店导入模板.xls"
                    this.inportUrlAPI = this.$api.API_MDM_ORG_IMPORTEXTERNAL
                  } else if (item.name == 'JJEDS人员导入') {
                    this.templateUrl = "/static/template/门店导入模板.xls"
                    this.inportUrlAPI = this.$api.API_MDM_ORG_IMPORTTHREEORG
                  }
                } else if(item.event === "search()") {
                  console.log(111);
                    let self = this
                    this.searchs.push({
                    label: '查询人员信息',
                    page: 'store',
                    searchData: this.searchData,
                    items: this.searchItems,
                    selectItem: function (formData, items) {
                      // console.log(items)
                      self.searchs.pop()
                      self.searchItems = items;
                      self.searchData = formData;
                      let conditions = self.conditions.filter(item=>{
                        return !item.label
                      })
                      // 回调
                      for (let idx in items) {
                        let item = items[idx]
                        if (item.checked == true) {
                          conditions.push({
                            checked: true,
                            label: item.name,
                            prop: item.vkey ? item.vkey : item.key,
                            valueName: formData[item.key],
                            value: item.vkey ? formData[item.vkey] : formData[item.key]
                          })
                        }
                      }
                      self.conditions = conditions
                    },
                  })
                }
                this.button = item
            },
            initData() {
              // 部门
              this.$http.get(this.$api.API_SELECT_DEP_LIST).then(resp=>{
                // console.log(resp, 1);
                  for (let i=0;i<resp.list.length;i++) {
                      let node = {value:resp.list[i].pkid,label:resp.list[i].depName}
                      this.depList.push(node)
                      // this.add.addItems[16].options = this.depList
                  }
              },msg=>{})
              // 渠道
              this.$http.get(this.$api.API_SELECT_CHANNEL_LIST).then(resp=>{
                // console.log(resp, 2);
                  for (let i=0;i<resp.list.length;i++) {
                      let node = {value:resp.list[i].pkid,label:resp.list[i].channelName}
                      this.channelList.push(node)
                      // this.add.addItems[17].options = this.channelList
                  }
              },msg=>{})
              // 地区
              this.$http.get(this.$api.API_SELECT_REG_LIST).then(resp=>{
                // console.log(resp, 3);
                  for (let i=0;i<resp.list.length;i++) {
                      let node = {value:resp.list[i].pkid,label:resp.list[i].regName}
                      this.regList.push(node)
                      // this.add.addItems[18].options = this.regList
                  }
              },msg=>{})
              // 大区
              this.$http.get(this.$api.API_SELECT_AREA_LIST).then(resp=>{
                // console.log(resp, 4);
                  for (let i=0;i<resp.list.length;i++) {
                      let node = {value:resp.list[i].pkid,label:resp.list[i].areaName}
                      this.zoneList.push(node)
                      // this.add.addItems[19].options = this.zoneList
                  }
              },msg=>{})
              // 业务属性
              this.$http.get(this.$api.API_SELECT_ATTR_LIST).then(resp=>{
                // console.log(resp, 5);
                  for (let i=0;i<resp.list.length;i++) {
                      let node = {value:resp.list[i].pkid,label:resp.list[i].attrName}
                      this.attrList.push(node)
                      this.add.addItems[6].options = this.attrList
                      // this.add.addItems[20].options = this.attrList
                  }
              },msg=>{})
            },
            editBack(item) {
                this.button = item
            },
            tableSelect(row) {
                this.row = row
            },
            conditionChange(conditions) {
                this.row = null
                this.$refs.list.search()
            },
            searchBack() {
              this.searchs.pop()
            },
            openItem(item) {
                this.button = this.$config.BTNS.DETAIL
            },
            close(item) {
                this.button = item
            }
        },
        created(){
            this.initData()
            // console.log(this.$config.BTNS, 789);
        },
        components:{CommonExport, SearchPopUp, CommonList,CommonBtn,CommonEdit,EnsurePopUp,CommonInport,CommonSearchPend},
    }
</script>
